package com.zc.im.seqsvr.router;

import com.zc.im.seqsvr.handler.UserSeqHandler;
import com.zc.im.seqsvr.vo.router.RoutePath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * Project：im
 * Date：2022/4/13
 * Time：19:08
 * Description：路由配置
 *
 * @author Challen.Zhang
 * @version 1.0
 */
@Configuration
public class BaseRouter {

    @Bean
    public RouterFunction<ServerResponse> routerFunction(UserSeqHandler userSeqHandler) {
        return RouterFunctions.route()
                .POST(RoutePath.INCR_AND_GET_SEQ_BY_USER_ID, userSeqHandler::getSeqByUserId)
                .PUT(RoutePath.CREATE_SEQ_BY_USER_ID, userSeqHandler::createSeqByUserId)
                .POST("/test",userSeqHandler::test)
                .GET("/test",userSeqHandler::test1)
                .build();
    }

}
